{% extends "base.html" %} {% block title %}新闻列表{% endblock %} {% block
content %}
<main>
  <div class="news-list">
    <div class="catelog">
      <div class="title">信息分类</div>
      {% for subset in subsets %}
      <div class="item {% if subset.subset_id==subset_id %} active{% endif %}">
        <a href="{{ url_for("news.news_list", subset=subset.subset_id) }}">{{ subset.subset_name }}</a>
      </div>
       {% endfor %}
    </div>

    <div class="wrap2">
      <div class="title">
        <div class="text">{{ subsets[subset_id-1].subset_name }}</div>
        <div class="line">
          <div class="bottom"></div>
        </div>
      </div>
      <ul>
        {% for article in articles %}
        <li>
          <span>-</span>
          <span class="news-title"
            ><a
              href="{{ url_for('news.news_detail', article_id=article.article_id) }}"
              target="_blank"
              >{{ article.title }}</a
            ></span
          >
          <span class="news-date"
            >{{ article.create_time.strftime("%Y-%m-%d")}}</span
          >
        </li>
        {% endfor %}
      </ul>

      
      <div class="pagination"> 
            {% if paginator.has_prev %}
              <a class="pagination-item" href="{{ paginator.get_page_url(paginator.prev_num) }}">上一页</a>
            {% endif %}

            {% for page_num in paginator.iter_pages() %}
                {% if page_num == paginator.page %}
                    <div class="pagination-item active">{{ page_num }}</div>
                {% else %}
                    <a class="pagination-item" href="{{ paginator.get_page_url(page_num) }}">{{ page_num }}</a>
                {% endif %}
            {% endfor %}

            {% if paginator.has_next %}
            <a class="pagination-item" href="{{ paginator.get_page_url(paginator.next_num) }}">下一页</a>
            {% endif %}
          </div>
        
    </div>
  </div>
</main>
{% endblock %}
